		**********************************************************
		** File: Figure_C14.do									**
		** Paper: Human Trafficking Indicators: A New Dataset	**
		** Author: Richard Frank								**
		** Date: July 11, 2021									**
		** Task: Creating Figure C14							**
 		**********************************************************

			clear
			version 16.1
			set max_memory 32g, permanently
			set seed 1234
			set level 95 		
 
	cd "~"
	 use "HTI 00-17.dta", clear
	  
 
	 ******************* 
	 *** CONVICTINFO ***
	 *******************

	 drop if ccode<0
 
	 **DICHOTOMIZING **
	 
		gen convdich=.
		replace convdich=1 if convictinfo==1
		label var convdich "Convict yes (dich)"

		gen convno=.
		replace convno =1 if convictinfo==0 
		replace convno =1 if convictinfo==-1
		label var convno "Convict no/ nomention (dich)"
	  

	**TOTAL IN A YEAR **
		sort year
		by year: egen convtot=count(convdich)
		label var convtot "TOtal convict yes"

		sort year
		by year: egen notot=count(convno)
		label var notot "Total convictno"
 
	  gen totcount=.
	  replace totcount=82 if year==2001
	  replace totcount=89 if year==2002
	  replace totcount=124 if year==2003
	  replace totcount=139 if year==2004
	  replace totcount=147 if year==2005
	  replace totcount=156 if year==2006 
	  replace totcount=161 if year==2007
	  replace totcount=165 if year==2008
	  replace totcount=172 if year==2009	  
	  replace totcount=173 if year==2010
	  replace totcount=179 if year==2011
	  replace totcount=182 if year==2012	  
	  replace totcount=182 if year==2013
	  replace totcount=178 if year==2014
	  replace totcount=178 if year==2015	  
	  replace totcount=177 if year==2016
	  replace totcount=179 if year==2017	 

	  
	**PERCENTAGE **

	gen convpct=convtot/totcount
	label var convpct "Yes"

	gen nopct=notot/totcount
	label var notot "No"

	twoway (line convpct year, sort) (line nopct year, sort), /// 
	 ytitle(% of countries in sample) title(Convictinfo)  legend(pos(6) cols(3)) xtitle("") xlabel(2001(2)2017)
	graph save convictinfo.gph, replace

  
	 ******************* 
	 *** Prosecutions ***
	 *******************
	 
 
	 use "/Users/rich/Dropbox/research/ht/Data/HTI/HTI 00-17.dta", clear
	  
	 drop if ccode<0
 
	 
	 **DICHOTOMIZING **
	 
		gen prosedich=.
		replace prosedich=1 if prosnum~=.
		label var prosedich "pros yes (dich)"

	** Total number
		
		collapse (sum) prosnum prosedich, by(year)
		
			 
		  gen totcount=.
		  replace totcount=82 if year==2001
		  replace totcount=89 if year==2002
		  replace totcount=124 if year==2003
		  replace totcount=139 if year==2004
		  replace totcount=147 if year==2005
		  replace totcount=156 if year==2006 
		  replace totcount=161 if year==2007
		  replace totcount=165 if year==2008
		  replace totcount=172 if year==2009	  
		  replace totcount=173 if year==2010
		  replace totcount=179 if year==2011
		  replace totcount=182 if year==2012	  
		  replace totcount=182 if year==2013
		  replace totcount=178 if year==2014
		  replace totcount=178 if year==2015	  
		  replace totcount=177 if year==2016
		  replace totcount=179 if year==2017	 

	  
	**PERCENTAGE **

		gen prospct=prosedich/totcount
		label var prospct "Yes"

	 

		twoway (line prospct year, sort)(line prosnum year , yaxis(2)), /// 
		 ytitle(% of countries in sample) title(Prosecutions reported)  legend(pos(6) cols(3)) xtitle("") xlabel(2001(2)2017)
		graph save prosecutions.gph, replace

		graph combine convictinfo.gph prosecutions.gph
	 
